package com.aizhixin.lab.docker.service;

import com.aizhixin.lab.docker.domain.ContainerExperimentDomain;
import com.aizhixin.lab.docker.repository.ChapterContainerRepositroy;
import com.aizhixin.lab.docker.repository.ChapterExperimentRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
@Transactional
public class ChapterExperimentService {
    @Autowired
    private ChapterExperimentRepository chapterExperimentRepository;
    @Autowired
    private ChapterContainerRepositroy chapterContainerRepositroy;
    public void deleteChapterExperiment(ContainerExperimentDomain containerExperimentDomain, String userId) {
        chapterExperimentRepository.deleteAllByUserIdAndChapterIdAndCourseId(userId, containerExperimentDomain.getChapterId(), containerExperimentDomain.getCourseId());
//        chapterContainerRepositroy.countAllByUserIdAndChapterId(userId,containerExperimentDomain.getChapterId());
    }


}
